﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace OneMangaReader
{
    public partial class frmViewer : Form
    {
        private Manga manga;

        private string onemanga_url = @"http://www.onemanga.com";

        public frmViewer()
        {
            InitializeComponent();
        }

        private void groupBox1_Enter(object sender, EventArgs e)
        {

        }

        private void frmViewer_Load(object sender, EventArgs e)
        {

        }

        private void btnGO_Click(object sender, EventArgs e)
        {


            manga = new Manga("Naruto", this.txtMangaURL.Text);
            manga.CreateManga();

            this.cboChapters.Items.Clear();
            this.cboChapters.DisplayMember = "ChapterID";
            this.cboChapters.ValueMember = "URL";

            foreach (Chapter item in manga.Chapters)
            {
                this.cboChapters.Items.Add(item);
            }
        }

        private void cboChapters_SelectedIndexChanged(object sender, EventArgs e)
        {
            Chapter chap = (Chapter)cboChapters.SelectedItem;

            chap.CreatePages(manga);

            this.cboPages.Items.Clear();
            this.cboPages.DisplayMember = "PageID";

            foreach (Page item in chap.Pages)
            {
                this.cboPages.Items.Add(item);
            }

        }
    }
}
